package com.mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.entity.Goods;
import com.mall.entity.RecommendGoods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author ShouPeng
 * @since 2023-04-15
 * 推荐商品mapper
 */
@Repository
@Mapper
public interface RecommendGoodsMapper extends BaseMapper<RecommendGoods> {

    /**
     * @return goods
     */
    @Select("select mrg.goods_id as goods_id,goods_cover,goods_name,goods_desc,goods_price from mall_recommend_goods mrg " +
            "left join mall_goods mg on mrg.goods_id = mg.goods_id where mg.goods_is_sale = true  order by mrg.recommend_goods_sort DESC")
    List<Goods> queryRecommendGoods();
}
